package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.vo.DishListVo;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {
    Page<DishVO> pageDish(DishPageQueryDTO dishPageQueryDTO);

    void add(Dish dish);

    void Update(Dish dish);
@Select("select d.*,c.name as category_name from sky_take_out.dish d left join sky_take_out.category c on d.category_id = c.id where d.id=#{id}")
    DishVO dishById(Long id);

    void dishDelete(Integer[] ids);
@Select("select * from sky_take_out.dish where category_id=#{categoryId}")
    List<Dish> categoryByIdList(Long categoryId);

    Integer countByMap(Map map);
}
